package com.ruoyi.project.system.service.impl;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.concurrent.TimeUnit;

import com.alipay.api.request.AlipayTradeRefundRequest;
import com.alipay.api.response.AlipayTradeRefundResponse;
import com.github.binarywang.wxpay.bean.request.WxPayRefundRequest;
import com.github.binarywang.wxpay.bean.result.WxPayRefundResult;
import com.github.binarywang.wxpay.service.WxPayService;
import com.alibaba.fastjson.JSONObject;
import com.alipay.api.AlipayApiException;
import com.alipay.api.AlipayClient;
import com.alipay.api.DefaultAlipayClient;
import com.alipay.api.domain.AlipayTradeAppPayModel;
import com.alipay.api.request.AlipayTradeAppPayRequest;
import com.alipay.api.response.AlipayTradeAppPayResponse;
import com.github.binarywang.wxpay.bean.order.WxPayAppOrderResult;
import com.github.binarywang.wxpay.bean.request.WxPayUnifiedOrderRequest;
import com.github.binarywang.wxpay.exception.WxPayException;
import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.exception.BaseException;
import com.ruoyi.common.exception.CustomException;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.DoubleUtil;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.ToolUtil;
import com.ruoyi.common.utils.pay.AlipayConfig;
import com.ruoyi.framework.aspectj.lang.annotation.DataScope;
import com.ruoyi.framework.redis.RedisCache;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.project.system.domain.*;
import com.ruoyi.project.system.service.*;
import io.swagger.models.auth.In;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import com.ruoyi.project.system.mapper.SysServiceOrderMapper;
import org.springframework.transaction.annotation.Transactional;
import test.util.SequenceUtils;

/**
 * 用户服务订单Service业务层处理
 * 
 * @author jjp
 * @date 2020-04-16
 */
@Service
public class SysServiceOrderServiceImpl implements ISysServiceOrderService 
{
    @Autowired
    private SysServiceOrderMapper sysServiceOrderMapper;

    @Autowired
    public RedisTemplate redisTemplate;

    @Autowired
    private RedisCache redisCache;

    @Autowired
    private ISysCouponService sysCouponService;

    @Autowired
    private ISysTypeDetailService sysTypeDetailService;

    @Autowired
    private ISysReceiveCouponService sysReceiveCouponService;

    @Autowired
    private ISysSkuService sysSkuService;

    @Autowired
    private WxPayService wxPayService;

    @Autowired
    private ISysConfigService configService;

    @Autowired
    private ISysMobileUserService sysMobileUserService;

    @Autowired
    private ISysDeptService sysDeptService;

    @Autowired
    private ISysAccountsService sysAccountsService;

    @Autowired
    private ISysUserService sysUserService;

    @Autowired
    private ISysWorkerMoneyService sysWorkerMoneyService;

    /**
     * 查询用户服务订单
     * 
     * @param orderId 用户服务订单ID
     * @return 用户服务订单
     */
    @Override
    public SysServiceOrder selectSysServiceOrderById(Long orderId)
    {
        return sysServiceOrderMapper.selectSysServiceOrderById(orderId);
    }

    @Override
    public SysServiceOrder selectSysServiceOrderByCode(String orderCode) {
        return sysServiceOrderMapper.selectSysServiceOrderByCode(orderCode);
    }

    /**
     * 查询用户服务订单列表
     * 
     * @param sysServiceOrder 用户服务订单
     * @return 用户服务订单
     */
    @Override
    @DataScope(deptAlias = "d")
    public List<SysServiceOrder> selectSysServiceOrderList(SysServiceOrder sysServiceOrder)
    {
        return sysServiceOrderMapper.selectSysServiceOrderList(sysServiceOrder);
    }

    @Override
    public List<SysServiceOrder> sellectMyOrderList(SysServiceOrder sysServiceOrder) {
        return sysServiceOrderMapper.sellectMyOrderList(sysServiceOrder);
    }

    /**
     * 新增用户服务订单
     * 
     * @param sysServiceOrder 用户服务订单
     * @return 结果
     */
    @Override
    public int insertSysServiceOrder(SysServiceOrder sysServiceOrder)
    {
        sysServiceOrder.setCreateTime(DateUtils.getNowDate());
        return sysServiceOrderMapper.insertSysServiceOrder(sysServiceOrder);
    }

    @Override
    @Transactional
    public AjaxResult createOrderService(SysServiceOrder sysServiceOrder) {
        if(null==sysServiceOrder){
            return AjaxResult.error("参数错误");
        }
        if(null==sysServiceOrder.getAddressId()){
            return AjaxResult.error("地址必选");
        }
//        if(null==sysServiceOrder.getPhone()){
//            return AjaxResult.error("手机号为空");
//        }
        if(null==sysServiceOrder.getTypeDetailId()){
            return AjaxResult.error("服务分类必传");
        }
//        if(null==sysServiceOrder.getOrderType()){
//            return AjaxResult.error("订单类型为空");
//        }
        if(null==sysServiceOrder.getMoney()){
            return AjaxResult.error("订单实付金额为空");
        }
        if(null==sysServiceOrder.getServiceTime()){
            return AjaxResult.error("上门时间不能为空");
        }
        if(null==sysServiceOrder.getTotal()){
            return AjaxResult.error("订单数量必填");
        }
        Double trueMoney=0.00;
        SysTypeDetail sysTypeDetail=sysTypeDetailService.selectSysTypeDetailById(sysServiceOrder.getTypeDetailId());
        if(null==sysTypeDetail){
            return AjaxResult.error("分类详情id错误");
        }

        if(sysTypeDetail.getCharge().equals("1")){
            /**
             * 按照单价收费
             */
            trueMoney=DoubleUtil.mul(sysTypeDetail.getMoney(),Double.valueOf(sysServiceOrder.getTotal()));
            if(!(""+trueMoney).equals(sysServiceOrder.getTotalMoney()+"")){
                return AjaxResult.error("订单总价格计算错误");
            }
        }else if(sysTypeDetail.getCharge().equals("2")){
            /**
             * 按照收费项目收费
             */
            if(null==sysServiceOrder.getSkuId()){
                return AjaxResult.error("订单属性skuId未传");
            }
            SysSku sysSku=sysSkuService.selectSysSkuById(sysServiceOrder.getSkuId());
            trueMoney=DoubleUtil.mul(sysSku.getMoney(),Double.valueOf(sysServiceOrder.getTotal()));
            if(!(""+trueMoney).equals(sysServiceOrder.getTotalMoney()+"")){
                return AjaxResult.error("订单总价格计算错误");
            }
            sysServiceOrder.setData(sysSku.getData());
        }
        Object value= configService.selectConfigByKey("CONFIG_SERVICE_ORDER");
        if(null!=sysServiceOrder.getCouponId()){
            SysCoupon sysCoupon=sysCouponService.selectSysCouponById(sysServiceOrder.getCouponId());
            trueMoney=DoubleUtil.sub(sysServiceOrder.getTotalMoney(),sysCoupon.getMoney());
            if(!(""+trueMoney).equals(sysServiceOrder.getMoney()+"")){
                return AjaxResult.error("订单价格计算错误");
            }
            sysServiceOrder.setCouponMoney(sysCoupon.getMoney());
            SysReceiveCoupon sysReceiveCoupon=new SysReceiveCoupon();
            sysReceiveCoupon.setCouponId(sysServiceOrder.getCouponId());
            sysReceiveCoupon.setMobileUserId(SecurityUtils.getLoginUser().getSysMobileUser().getMobileUserId());
            sysReceiveCoupon.setUsed("0");
            List<SysReceiveCoupon> list=sysReceiveCouponService.selectSysReceiveCouponList(sysReceiveCoupon);
            if(list.isEmpty()){
                return AjaxResult.error("优惠券使用错误");
            }
            SysReceiveCoupon receiveCoupon=list.get(0);
            receiveCoupon.setUsed("1");
            sysReceiveCouponService.updateSysReceiveCoupon(receiveCoupon);
        }
        //** 获取今天的日期:yyyyMMdd *//*
        String date = SequenceUtils.getCurentDate();
        String key = "serial.service:" + date;
        //** 自增 *//*
        long sequence = redisTemplate.opsForValue().increment(key);
        String orderCode = date+SequenceUtils.getSequence(sequence);
        sysServiceOrder.setOrderCode("S"+orderCode);
        sysServiceOrder.setMobileUserId(SecurityUtils.getLoginUser().getSysMobileUser().getMobileUserId());
        sysServiceOrder.setOrderStatus("0");
        int flag=sysServiceOrderMapper.insertSysServiceOrder(sysServiceOrder);
        /**
         * 设置服务订单超时时间
         */

        redisCache.setCacheObject( sysServiceOrder.getOrderCode(), sysServiceOrder.getOrderCode(),Integer.valueOf(value+""), TimeUnit.MINUTES);
        if(flag==1){
            return AjaxResult.success("创建成功",sysServiceOrder.getOrderId());
        }
        return AjaxResult.error("下单失败");
    }

    @Override
    public AjaxResult payOrderService(SysServiceOrder sysServiceOrder) {
        if(null==sysServiceOrder){
            return AjaxResult.error("参数错误");
        }
        if(null==sysServiceOrder.getOrderId()){
            return AjaxResult.error("订单id必传");
        }

        if(null==sysServiceOrder.getPayType()){
            return AjaxResult.error("支付方式必传");
        }
        SysServiceOrder order=sysServiceOrderMapper.selectSysServiceOrderById(sysServiceOrder.getOrderId());
        if(null==order){
            return AjaxResult.error("订单id错误");
        }
        if(!order.getOrderStatus().equals("0")){
            return AjaxResult.error("订单状态错误");
        }
        if(null==order.getMoney()){
            return AjaxResult.error("订单金额错误");
        }
        Double money=order.getMoney();
        String title="蚂蚁生活服务订单";
        //支付宝
        if(sysServiceOrder.getPayType().equals("1")){
            // SDK 公共请求类，包含公共请求参数，以及封装了签名与验签，开发者无需关注签名与验签
            //调用RSA签名方式，这个不用你管，只要你配置文件是正确的
            AlipayClient client = new DefaultAlipayClient(AlipayConfig.URL,
                    AlipayConfig.APPID, AlipayConfig.RSA_PRIVATE_KEY, AlipayConfig.FORMAT,
                    AlipayConfig.CHARSET, AlipayConfig.ALIPAY_PUBLIC_KEY,AlipayConfig.SIGNTYPE);
            AlipayTradeAppPayRequest request = new AlipayTradeAppPayRequest();
            AlipayTradeAppPayModel model = new AlipayTradeAppPayModel();
            model.setSubject(title);//标题
            model.setOutTradeNo(order.getOrderCode());//商家唯一订单号
            model.setTimeoutExpress("15m");//1分钟没有支付，交易将会关闭
            model.setTotalAmount(money+"");//订单总额
            request.setBizModel(model);
            try {
                AlipayTradeAppPayResponse response  =  client.sdkExecute(request);
                System.out.println(JSONObject.toJSONString(response));
                if(response.isSuccess()){
                    return AjaxResult.success(null,response.getBody());
                }
            } catch (AlipayApiException e) {
                e.printStackTrace();
            }
        }else if(sysServiceOrder.getPayType().equals("2")){
            //微信支付
            BigDecimal bg = new BigDecimal(money * 100);
            double doubleValue = bg.setScale(2,BigDecimal.ROUND_HALF_UP).doubleValue();
            WxPayUnifiedOrderRequest.WxPayUnifiedOrderRequestBuilder builder = WxPayUnifiedOrderRequest.newBuilder();
            WxPayUnifiedOrderRequest request  = builder.body(title)
                    .totalFee((int)doubleValue).outTradeNo(order.getOrderCode())
                    .spbillCreateIp("0.0.0.0")
                    .tradeType("APP").build();
            WxPayAppOrderResult o = null;
            try {
                o = wxPayService.createOrder(request);
            } catch (WxPayException e) {
                throw new BaseException("微信支付报错");
            }
            return AjaxResult.success(o);
        }
        return AjaxResult.error("支付失败");
    }

    @Override
    public Boolean alipayBack(String orderCode,String payType,String totalMoney) {
        SysServiceOrder sysServiceOrder=sysServiceOrderMapper.selectSysServiceOrderByCode(orderCode);
        if(new BigDecimal(totalMoney).compareTo(new BigDecimal(sysServiceOrder.getMoney()))!=0){
            //订单金额错误
            return false;
        }
        if(null!=sysServiceOrder){
            if("0".equals(sysServiceOrder.getOrderStatus())){
                sysServiceOrder.setOrderStatus("1");
                sysServiceOrder.setPayTime(new Date());
                sysServiceOrder.setPayType(payType);
                int flag=sysServiceOrderMapper.updateSysServiceOrder(sysServiceOrder);
                if(flag>0){
                    return true;
                }
            }
        }
        return false;
    }
    /**
     * 修改用户服务订单
     * 
     * @param sysServiceOrder 用户服务订单
     * @return 结果
     */
    @Override
    public int updateSysServiceOrder(SysServiceOrder sysServiceOrder)
    {
        return sysServiceOrderMapper.updateSysServiceOrder(sysServiceOrder);
    }

    @Override
    public AjaxResult audit(SysServiceOrder sysServiceOrder) {
        if(null==sysServiceOrder.getOrderId()){
            return AjaxResult.error("订单id必传!");
        }
        SysServiceOrder order=sysServiceOrderMapper.selectSysServiceOrderById(sysServiceOrder.getOrderId());
        if(!"0".equals(order.getCancelStatus())){
            return AjaxResult.error("订单状态错误");
        }
        if("1".equals(sysServiceOrder.getCancelStatus())){
            //审核同意退款
            if("1".equals(sysServiceOrder.getPayType())){
                //支付方式为支付宝
                AlipayTradeRefundResponse response = null;
                AlipayClient alipayClient = new DefaultAlipayClient(AlipayConfig.URL,
                        AlipayConfig.APPID, AlipayConfig.RSA_PRIVATE_KEY, AlipayConfig.FORMAT,
                        AlipayConfig.CHARSET, AlipayConfig.ALIPAY_PUBLIC_KEY,AlipayConfig.SIGNTYPE);
                AlipayTradeRefundRequest request = new AlipayTradeRefundRequest();
                request.setBizContent("{"+
                        "\"out_trade_no\":\""+order.getOrderCode()+"\"," +
                        "\"refund_amount\":"+order.getMoney()+"," +
                        "\"out_request_no\":\""+order.getOrderCode()+"\"" +
                        "  }");
                try {
                    response = alipayClient.execute(request);
                } catch (AlipayApiException e) {
                    e.printStackTrace();
                }
                if(response == null){
                    return AjaxResult.error("支付宝退款错误！");
                }
                if(response.isSuccess()){
                    order.setCancelStatus("1");
                    order.setOrderStatus("5");
                    sysServiceOrderMapper.updateSysServiceOrder(order);
                    //判断是否使用了优惠券
                    if(null!=order.getCouponId()){
                        SysReceiveCoupon sysReceiveCoupon=new SysReceiveCoupon();
                        sysReceiveCoupon.setCouponId(order.getCouponId());
                        sysReceiveCoupon.setMobileUserId(order.getMobileUserId());
                        sysReceiveCoupon.setUsed("1");
                        List<SysReceiveCoupon> list=sysReceiveCouponService.selectSysReceiveCouponList(sysReceiveCoupon);
                        if(!list.isEmpty()){
                            SysReceiveCoupon receiveCoupon=list.get(0);
                            receiveCoupon.setUsed("0");
                            sysReceiveCouponService.updateSysReceiveCoupon(receiveCoupon);
                        }
                    }
                    return AjaxResult.success("退款成功!");
                }
            }
            if("2".equals(sysServiceOrder.getPayType())){
                //支付方式为微信
                WxPayRefundResult result = null;
                WxPayRefundRequest wxPayRefundRequest=new WxPayRefundRequest();
                wxPayRefundRequest.setOutTradeNo(order.getOrderCode());
                wxPayRefundRequest.setOutRefundNo(order.getOrderCode());
                wxPayRefundRequest.setTotalFee(ToolUtil.yuanToFen(order.getMoney()+""));
                wxPayRefundRequest.setRefundFee(ToolUtil.yuanToFen(order.getMoney()+""));
                try {
                    result=wxPayService.refund(wxPayRefundRequest);
                } catch (WxPayException e) {
                    e.printStackTrace();
                    throw new CustomException("微信退款错误!");
                }
                if(result == null){
                    throw new CustomException("微信退款错误!");
                }
                if("SUCCESS".equals(result.getReturnCode())){
                    order.setCancelStatus("1");
                    order.setOrderStatus("5");
                    sysServiceOrderMapper.updateSysServiceOrder(order);
                    //判断是否使用了优惠券
                    if(null!=order.getCouponId()){
                        SysReceiveCoupon sysReceiveCoupon=new SysReceiveCoupon();
                        sysReceiveCoupon.setCouponId(order.getCouponId());
                        sysReceiveCoupon.setMobileUserId(order.getMobileUserId());
                        sysReceiveCoupon.setUsed("1");
                        List<SysReceiveCoupon> list=sysReceiveCouponService.selectSysReceiveCouponList(sysReceiveCoupon);
                        if(!list.isEmpty()){
                            SysReceiveCoupon receiveCoupon=list.get(0);
                            receiveCoupon.setUsed("0");
                            sysReceiveCouponService.updateSysReceiveCoupon(receiveCoupon);
                        }
                    }
                    return AjaxResult.success("退款成功!");
                }
            }
        }else if("2".equals(sysServiceOrder.getCancelStatus())){
            //审核不同意退款
            order.setCancelStatus("2");
            sysServiceOrderMapper.updateSysServiceOrder(order);
            return AjaxResult.success("审核成功!");
        }
        return AjaxResult.error("系统错误!");
    }

    @Override
    /**
     * 用户点击确认之后判断是否是被邀请的用户，如果是被邀请的用户则需要分成，然后判断返佣规则，
     * 给公司余额添加并且添加明细记录并且修改订单状态
     */
    @Transactional
    public AjaxResult confirmOrder(SysServiceOrder sysServiceOrder) {
        SysServiceOrder order=sysServiceOrderMapper.selectSysServiceOrderById(sysServiceOrder.getOrderId());
        if(null==order){
            return AjaxResult.error("订单id错误!");
        }
        //获取用户判断是否是商家邀请的
        SysMobileUser sysMobileUser=sysMobileUserService.selectSysMobileUserById(order.getMobileUserId());
        if(null!=sysMobileUser.getDeptId()){
            commission(order,sysMobileUser);
        }
        //获取工人判断工人是企业的还是个体，如果是企业的则把钱给到企业里面，如果是个人则给钱给个人
        SysUser sysUser=sysUserService.selectUserById(order.getUserId());
        SysDept sysDept=sysDeptService.selectDeptById(sysUser.getDeptId());
        if("1".equals(sysDept.getDeptType())){
            //公司的，给公司加钱并加明细
            sysDept.setMoney(ToolUtil.add(sysDept.getMoney(),order.getTotalMoney()));
            sysDeptService.updateDept(sysDept);
            SysAccounts sysAccounts=new SysAccounts();
            sysAccounts.setDeptId(sysDept.getDeptId());
            sysAccounts.setMoney(order.getTotalMoney());
            sysAccounts.setMoneyType("0");
            sysAccounts.setOrderId(order.getOrderId());
            sysAccounts.setCreateTime(new Date());
            sysAccountsService.insertSysAccounts(sysAccounts);
        }else if("2".equals(sysDept.getDeptType())){
            //个人的，给个人加钱并加明细
            sysUser.setMoney(ToolUtil.add(sysUser.getMoney()==null?0.0:sysUser.getMoney(),order.getTotalMoney()));
            sysUserService.resetPwd(sysUser);
            SysWorkerMoney sysWorkerMoney=new SysWorkerMoney();
            sysWorkerMoney.setUserId(sysUser.getUserId());
            sysWorkerMoney.setOrderId(order.getOrderId());
            sysWorkerMoney.setMoney(order.getTotalMoney());
            sysWorkerMoney.setMoneyType("0");
            sysWorkerMoney.setCreateTime(new Date());
            sysWorkerMoneyService.insertSysWorkerMoney(sysWorkerMoney);
        }
        order.setOrderStatus("3");
        sysServiceOrderMapper.updateSysServiceOrder(order);
        return AjaxResult.success("操作成功!");
    }

    @Override
    public void confirmService() {
       List<SysServiceOrder> orders=sysServiceOrderMapper.confirmOrderList();
        System.out.println("++++++++"+orders.size());
       if(!orders.isEmpty()){
           for(SysServiceOrder order:orders){
               //获取用户判断是否是商家邀请的
               SysMobileUser sysMobileUser=sysMobileUserService.selectSysMobileUserById(order.getMobileUserId());
               if(null!=sysMobileUser.getDeptId()){
                   commission(order,sysMobileUser);
               }
               //获取工人判断工人是企业的还是个体，如果是企业的则把钱给到企业里面，如果是个人则给钱给个人
               SysUser sysUser=sysUserService.selectUserById(order.getUserId());
               SysDept sysDept=sysDeptService.selectDeptById(sysUser.getDeptId());
               if("1".equals(sysDept.getDeptType())){
                   //公司的，给公司加钱并加明细
                   sysDept.setMoney(ToolUtil.add(sysDept.getMoney(),order.getTotalMoney()));
                   sysDeptService.updateDept(sysDept);
                   SysAccounts sysAccounts=new SysAccounts();
                   sysAccounts.setDeptId(sysDept.getDeptId());
                   sysAccounts.setMoney(order.getTotalMoney());
                   sysAccounts.setMoneyType("0");
                   sysAccounts.setOrderId(order.getOrderId());
                   sysAccounts.setCreateTime(new Date());
                   sysAccountsService.insertSysAccounts(sysAccounts);
               }else if("2".equals(sysDept.getDeptType())){
                   //个人的，给个人加钱并加明细
                   sysUser.setMoney(ToolUtil.add(sysUser.getMoney()==null?0.0:sysUser.getMoney(),order.getTotalMoney()));
                   sysUserService.resetPwd(sysUser);
                   SysWorkerMoney sysWorkerMoney=new SysWorkerMoney();
                   sysWorkerMoney.setUserId(sysUser.getUserId());
                   sysWorkerMoney.setOrderId(order.getOrderId());
                   sysWorkerMoney.setMoney(order.getTotalMoney());
                   sysWorkerMoney.setMoneyType("0");
                   sysWorkerMoney.setCreateTime(new Date());
                   sysWorkerMoneyService.insertSysWorkerMoney(sysWorkerMoney);
               }
               order.setOrderStatus("3");
               sysServiceOrderMapper.updateSysServiceOrder(order);
           }
       }
    }

    public void commission(SysServiceOrder order,SysMobileUser user){
        String key=configService.selectConfigByKey("CONFIG_COMMISSION_TYPE")+"";
        Object money=configService.selectConfigByKey(key)+"";
        Double addMoney=0.0;
        if("CONFIG_COMMISSION_MONEY".equals(key)){
            //返佣为每单多少钱
            addMoney=Double.valueOf(money+"");
        }else if("CONFIG_COMMISSION_RATE".equals(key)){
            //返佣为每单总金额的多少钱
            addMoney=ToolUtil.mul(Double.valueOf(money+""),Double.valueOf(order.getTotal()));
        }
        SysDept sysDept=sysDeptService.selectDeptById(user.getDeptId());
        sysDept.setMoney(ToolUtil.add(sysDept.getMoney(),addMoney));
        sysDeptService.updateDept(sysDept);
        SysAccounts sysAccounts=new SysAccounts();
        sysAccounts.setDeptId(sysDept.getDeptId());
        sysAccounts.setMoney(addMoney);
        sysAccounts.setMoneyType("2");
        sysAccounts.setOrderId(order.getOrderId());
        sysAccounts.setCreateTime(new Date());
        sysAccountsService.insertSysAccounts(sysAccounts);
    }


    /**
     * 批量删除用户服务订单
     * 
     * @param orderIds 需要删除的用户服务订单ID
     * @return 结果
     */
    @Override
    public int deleteSysServiceOrderByIds(Long[] orderIds)
    {
        return sysServiceOrderMapper.deleteSysServiceOrderByIds(orderIds);
    }

    /**
     * 删除用户服务订单信息
     * 
     * @param orderId 用户服务订单ID
     * @return 结果
     */
    @Override
    public int deleteSysServiceOrderById(Long orderId)
    {
        return sysServiceOrderMapper.deleteSysServiceOrderById(orderId);
    }
}
